#*******************************
#*		path define
#*********************************************
#*INCPATH and LIBPATH are defined in build.bat
#*

CC   = tcc.exe
AS   = ml.exe

ASFLASG = /c /Cx /Sa /W3
CFLAGS = -c  -I$(INCPATH)  
LFLAGS =  /m /3  /L$(LIBPATH)

#-------------modification area---------------
#Path may be need to modificated under some condition!

LINK = tlink.exe
#LINK = link.exe

PROGRAMS =   usb
#use tlink to compile need c0s.obj . other OBJs should be attached.
DEVICE_OBJS	= $(LIBPATH)\c0s.obj list.obj  memrw.obj pci.obj io.obj  \
                                     uhci.obj  ohci.obj storage.obj hid.obj\



LIBS= cs.lib
AttachLib= 
#------------ fixed area  --------------------
MAIN_OBJS =  $(PROGRAMS).obj
ObjList= $(DEVICE_OBJS) $(MAIN_OBJS)
LibList = $(LIBS) $(AttachLib)
#*******************************************************************************
#
all:   SETEV $(PROGRAMS).exe     


#*******************************************************************************
#                           SOURCE and OBJECT FILE DEPENDENCIES
#*******************************************************************************

.asm.obj:
    $(AS) $(ASFLASG) $*.asm

.cpp.obj:
    $(CC) $(CFLAGS) $*.cpp	

#*******************************************************************************
#                          EXE & COM FILE DEPENDENCIES
#*******************************************************************************

$(PROGRAMS).exe : $(MAIN_OBJS) $(DEVICE_OBJS) $(AttachLib)
	echo @<<$(PROGRAMS).CRF	
$(ObjList: = +^
)
$(PROGRAMS).EXE
$(PROGRAMS).MAP
$(LibList: = +^
);
<<KEEP
	$(LINK) $(LFLAGS) @$(PROGRAMS).CRF



#*******************************************************************************
#                               ENVIROMENT SETUP
#*******************************************************************************
SETEV:


#*******************************************************************************
#                               CLEANUP COMMANDS
#*******************************************************************************

clean:
    @if EXIST *.obj del  *.obj
    @if EXIST *.map del  *.map
    @if EXIST *.exe del  *.exe
    @if EXIST *.bak del  *.bak
    @if EXIST *.lib del  *.lib
    @if EXIST *.dsk del  *.dsk
    @if EXIST *.crf del  *.crf
    @if EXIST *.dpr del  *.dpr
    @echo Clean compelte!

